import React, {Component} from 'react';
import {Relax} from 'iflux2';
import {
  Form, 
  Radio
} from 'antd';
import noop from 'util/noop';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;

@Relax
export default class TypeSet extends Component{
  static defaultProps = {
    goodsDisplay: 0,
    onSetting: noop
  }
  render() {
    let {layoutProps, goodsDisplay} = this.props;
    return (
      <FormItem label='商品列表显示设置' {...layoutProps}>
        <RadioGroup onChange={this.handleChange} value={goodsDisplay}>
          <Radio value={0}>按SKU显示</Radio>
          <Radio value={1}>按SPU显示</Radio>
        </RadioGroup>
        <span className="ant-form-text">
          <a href="http://bbs.qianmi.com/thread-3202-1-1.html" target="_blank">什么是SKU，SPU?</a>
        </span>
      </FormItem>
    )
  }

  handleChange = (e) => {
    this.props.onSetting({goodsDisplay:e.target.value});
  }
}